package com.example.demo.service.impl;

import com.example.demo.entity.MenuEntity;
import com.example.demo.mapper.MenuMapper;
import com.example.demo.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MenuServiceImpl implements MenuService {

    // @Resource
    @Autowired
    private MenuMapper menuMapper;

    @Override
    public String getMenuName() {

        return "数据库查出来的姓名:" + menuMapper.getMenuName()  + "!!!";

    }

    @Override
    public int addMenu(MenuEntity menu) {

        // todo 其他业务处理
        int id = menuMapper.addMenu(menu);

        return menu.getMenuId();
    }

    @Override
    public MenuEntity getMenuById(int id) {
        return menuMapper.getMenuById(id);
    }
    @Override
    public int deleteMenuById(int id) {
        return menuMapper.deleteMenuById(id);
    }

    @Override
    public List<MenuEntity> list() {
        return menuMapper.menuList();
    }
}
